package oop;

public class HourlyEmployee extends Employee{
    private double hourlysalary;
    private double hoursworked;
    public HourlyEmployee(String name,int birthmonth,double hourlysalary,double hpursworked){
        super(name,birthmonth);
        this.hourlysalary=hourlysalary;
        this.hoursworked=hpursworked;
    }
    public double getHourlysalary(){
        return hourlysalary;
    }
    public double setHourlysalary(double hourlysalary){
        this.hourlysalary=hourlysalary;
        return hourlysalary;
    }
    public double getHoursworked(){
        return hoursworked;
    }
    public double setHoursworked(double hoursworked){
        this.hoursworked=hoursworked;
        return hoursworked;
    }
    @Override
    public double getSalary(int month){
        double salary=0;
        if(hoursworked>160){
            salary=160*hourlysalary+(hoursworked-160)*1.5;
        }
        else{
            salary=hoursworked*hourlysalary;
        }
        if(month==getBirthmonth()){
            salary+=100;
        }
        return salary;
    }
}
